Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the xml serialization order #246

Merged
merged 2 commits into from
May 19, 2024

Conversation

andreas-hilti
Copy link
Contributor

@andreas-hilti andreas-hilti commented Aug 17, 2023

Properties needs to be in front of Components in the xml format.

Compare https://cyclonedx.org/docs/1.4/xml/#type_component

This aims to address: CycloneDX/cyclonedx-cli#304

Properties needs to be in front of Components.

Signed-off-by: andreas hilti <andreas.hilti@bluewin.ch>

[XmlArray("properties")]
[XmlArrayItem("property")]
[ProtoMember(22)]
public List<Property> Properties { get; set; }
public bool ShouldSerializeProperties() { return Properties?.Count > 0; }

[XmlArray("components")]
[ProtoMember(21)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case: ProtoMember numbers should remain as they were, right? Or should match the order in other serializers?..

Copy link
Contributor Author

@andreas-hilti andreas-hilti Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they need to remain as they are; they are defined in
https://github.com/CycloneDX/specification/blob/c320fc0f0b46873864927d9d5684eea7ba439728/schema/bom-1.4.proto#L110-L113
(The order in the proto is different from the one in the xml.)

Signed-off-by: andreas hilti <andreas.hilti@bluewin.ch>
@mtsfoni mtsfoni added this to the 6.1.0 milestone May 18, 2024
@mtsfoni mtsfoni merged commit c7f1d64 into CycloneDX:main May 19, 2024
8 checks passed
mtsfoni added a commit that referenced this pull request May 20, 2024
The combination of #246 (add testcase) and #286 (activate strict mode) caused this 'conflict'

Signed-off-by: MTsfoni <mibau89@gmail.com>
@andreas-hilti andreas-hilti deleted the fix/xml_serialization_order branch September 1, 2024 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants